<?php
class Security_Visitor {
	
	private $id;
	private $email;
	private $roles = array();
	
	public function __construct($config = array()) {
		foreach ($config as $key => $value) {
			$this->$key = $value;
		}
	}
	
	public function has_role($role) {
		return in_array($role, $this->roles);
	}
	
	public function get_id() {
		return $this->id;
	}
	
	public function to_array() {
		return array('id' => $this->id, 
				'email' => $this->email, 
				'roles' => $this->roles);
	}
	
	public function __get($key) {
		return $this->$key;
	}
}